package micro.beauty.user.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import micro.beauty.common.core.ResponseData;
import micro.beauty.common.core.ResponseUtil;
import micro.beauty.order.feign.IOrderFeignClient;
import micro.beauty.user.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 系统用户控制器
 * @Author: Liuliya
 * @CreateDate: 2020/10/15 20:26
 */
@Api(tags = "系统用户")
@RestController
@RequestMapping("/user")
public class SysUserController {

    @Autowired
    SysUserService sysUserService;
    @Autowired
    IOrderFeignClient iOrderFeignClient;

    @GetMapping("/page")
    @ApiOperation("用户列表分页接口")
    public ResponseData page(@RequestParam("pageNo") Integer pageNo,
                             @RequestParam("pageSize") Integer pageSize) {
        Page userPage = sysUserService.findUserPage(pageNo, pageSize);
        return new ResponseUtil<>().data(userPage);
    }

    @GetMapping("/orders")
    @ApiOperation("远程调用测试接口")
    public ResponseData orders() {
        return iOrderFeignClient.list();
    }
}
